<html>
<head>
  <title>Evernote Export</title>
  <basefont face="微软雅黑" size="2" />
  <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
  <meta name="exporter-version" content="YXBJ Windows/600753 (zh-CN, DDL); Windows/10.0.0 (Win64);"/>
  <style>
    body, td {
      font-family: 微软雅黑;
      font-size: 10pt;
    }
  </style>
</head>
<body>
<a name="1024"/>

<div>
<span><div><span>整型（浮点型）转化为字符串</span><br/></div><div><br/></div><div style="box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.15);-en-codeblock:true;"><div>int length =55;</div><div>CString str;</div><div>str.Format(_T(&quot;%f&quot;),length);</div></div><div>浮点型转化为字符串型，只需int改为float就行，如果改为double，还需将最后一行代码改为<br/></div><div style="box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.15);-en-codeblock:true;"><div>str.Format(_T(&quot;%d&quot;),length);</div></div><div>字符串转化为整型(或浮点型)<br/></div><div style="box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.15);-en-codeblock:true;"><div>int length = _ttoi(_T(&quot;15&quot;))//字符转整型</div><div>float length = _ttof(_T(&quot;12.34&quot;))字符串转浮点型</div></div><div><br/></div></span>
</div>
<hr>
<a name="1026"/>

<div>
<span><div><div><span>   </span><span style="background-color:rgb(255, 255, 255);color:rgb(77, 77, 77);font-family:&quot;Microsoft YaHei&quot;, &quot;SF Pro Display&quot;, Roboto, Noto, Arial, &quot;PingFang SC&quot;, sans-serif;font-size:16px;font-variant-caps:normal;font-variant-ligatures:normal;line-height:26px;"><span style="box-sizing: border-box; outline: 0px; font-family: &quot;Microsoft YaHei&quot;, &quot;SF Pro Display&quot;, Roboto, Noto, Arial, &quot;PingFang SC&quot;, sans-serif; font-size: 16px; color: rgb(77, 77, 77); line-height: 26px; overflow-x: auto; overflow-wrap: break-word; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);">资源视图--Dialog--右键--添加资源--新建--对话框--右键--添加类。例如：添加CMyNewDlg类,在所要调的代码中(按钮点击方法中),先加头文件#include   &quot;CMyNewDlg.h &quot;,之后在按钮点击方法中:</span></span></div><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-family: &quot;Microsoft YaHei&quot;, &quot;SF Pro Display&quot;, Roboto, Noto, Arial, &quot;PingFang SC&quot;, sans-serif; font-size: 16px; color: rgb(77, 77, 77); line-height: 26px; overflow-x: auto; overflow-wrap: break-word; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);"></p><div>void COnclickDlg::OnBnClickedOk()</div><div>{</div><div>     CMyNewDlg  Dlg;</div><div>     Dlg.DoModal();</div><div style="margin-top: 1em; margin-bottom: 1em;"><span style="-en-paragraph:true;">}</span></div><div><span style="background-color:rgb(255, 255, 255);color:rgb(77, 77, 77);font-family:&quot;Microsoft YaHei&quot;, &quot;SF Pro Display&quot;, Roboto, Noto, Arial, &quot;PingFang SC&quot;, sans-serif;font-size:16px;font-variant-caps:normal;font-variant-ligatures:normal;line-height:26px;"><span style="box-sizing: border-box; outline: 0px; font-family: &quot;Microsoft YaHei&quot;, &quot;SF Pro Display&quot;, Roboto, Noto, Arial, &quot;PingFang SC&quot;, sans-serif; font-size: 16px; color: rgb(77, 77, 77); line-height: 26px; overflow-x: auto; overflow-wrap: break-word; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;"> </span></span><span style="background-color:rgb(255, 255, 255);color:rgb(77, 77, 77);font-family:&quot;Microsoft YaHei&quot;, &quot;SF Pro Display&quot;, Roboto, Noto, Arial, &quot;PingFang SC&quot;, sans-serif;font-size:16px;font-variant-caps:normal;font-variant-ligatures:normal;line-height:26px;"><span style="box-sizing: border-box; outline: 0px; font-family: &quot;Microsoft YaHei&quot;, &quot;SF Pro Display&quot;, Roboto, Noto, Arial, &quot;PingFang SC&quot;, sans-serif; font-size: 16px; color: rgb(77, 77, 77); line-height: 26px; overflow-x: auto; overflow-wrap: break-word; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); font-weight: bold;">方法二：非模态对话框</span></span></div><div style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-family: &quot;Microsoft YaHei&quot;, &quot;SF Pro Display&quot;, Roboto, Noto, Arial, &quot;PingFang SC&quot;, sans-serif; font-size: 16px; color: rgb(77, 77, 77); line-height: 26px; overflow-x: auto; overflow-wrap: break-word; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);"><span style="box-sizing: border-box; outline: 0px; font-family: &quot;Microsoft YaHei&quot;, &quot;SF Pro Display&quot;, Roboto, Noto, Arial, &quot;PingFang SC&quot;, sans-serif; font-size: 16px; color: rgb(77, 77, 77); line-height: 26px; overflow-x: auto; overflow-wrap: break-word; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);">资源视图--Dialog--右键--添加资源--新建--对话框--右键--添加类。例如：添加CMyNewDlg类,在所要调的代码中(按钮点击方法中),先加头文件#include   &quot;CMyNewDlg.h &quot;,之后在按钮点击方法中:</span></div><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-family: &quot;Microsoft YaHei&quot;, &quot;SF Pro Display&quot;, Roboto, Noto, Arial, &quot;PingFang SC&quot;, sans-serif; font-size: 16px; color: rgb(77, 77, 77); line-height: 26px; overflow-x: auto; overflow-wrap: break-word; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);"></p><div>void COnclickDlg::OnBnClickedOk()</div><div>{</div><div>     CMyNewDlg  *pDlg=new CMyNewDlg ;</div><div>     pDlg-&gt;Create(IDD_DIALOG2,this);</div><div>     pDlg-&gt;ShowWindow(SW_SHOW);</div><div style="margin-top: 1em; margin-bottom: 1em;"><span style="-en-paragraph:true;">}</span></div><div><br/></div></div></span>
</div>
<hr>
<a name="1028"/>

<div>
<span><div><p style="margin: 10px auto; padding: 0px; text-indent: 0px; color: rgb(57, 57, 57); font-family: verdana, &quot;ms song&quot;, Arial, Helvetica, sans-serif; font-size: 14px; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: left; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(250, 247, 239);"></p><div><span style="font-size: 12px;">1、create()</span></div><div style="margin-top: 1em; margin-bottom: 1em;"><span style="font-size: 12px;-en-paragraph:true;">针对不是通过资源文件上拖拉进度条控件生成的进度条，需要用此函数创建一个。</span></div><p style="margin: 10px auto; padding: 0px; text-indent: 0px; color: rgb(57, 57, 57); font-family: verdana, &quot;ms song&quot;, Arial, Helvetica, sans-serif; font-size: 14px; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: left; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(250, 247, 239);"></p><div><span style="font-size: 12px;">2、SetRange()</span></div><div style="margin-top: 1em; margin-bottom: 1em;"><span style="font-size: 12px;-en-paragraph:true;">设置进度条的起始值和终止值。</span></div><p style="margin: 10px auto; padding: 0px; text-indent: 0px; color: rgb(57, 57, 57); font-family: verdana, &quot;ms song&quot;, Arial, Helvetica, sans-serif; font-size: 14px; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: left; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(250, 247, 239);"></p><div><span style="font-size: 12px;">3、SetPos()</span></div><div style="margin-top: 1em; margin-bottom: 1em;"><span style="font-size: 12px;-en-paragraph:true;">设置进度条的当前位置。</span></div><p style="margin: 10px auto; padding: 0px; text-indent: 0px; color: rgb(57, 57, 57); font-family: verdana, &quot;ms song&quot;, Arial, Helvetica, sans-serif; font-size: 14px; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: left; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(250, 247, 239);"></p><div><span style="font-size: 12px;">4、OffSetPos()</span></div><div style="margin-top: 1em; margin-bottom: 1em;"><span style="font-size: 12px;-en-paragraph:true;">移动进度条一段距离</span></div><p style="margin: 10px auto; padding: 0px; text-indent: 0px; color: rgb(57, 57, 57); font-family: verdana, &quot;ms song&quot;, Arial, Helvetica, sans-serif; font-size: 14px; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: left; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(250, 247, 239);"></p><div><span style="font-size: 12px;">5、SetStep()</span></div><div style="margin-top: 1em; margin-bottom: 1em;"><span style="font-size: 12px;-en-paragraph:true;">设置步长</span></div><p style="margin: 10px auto; padding: 0px; text-indent: 0px; color: rgb(57, 57, 57); font-family: verdana, &quot;ms song&quot;, Arial, Helvetica, sans-serif; font-size: 14px; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: left; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(250, 247, 239);"></p><div><span style="font-size: 12px;">6、StepIt()</span></div><div style="margin-top: 1em; margin-bottom: 1em;"><span style="font-size: 12px;-en-paragraph:true;">按照步长来更新位置</span></div><p style="margin: 10px auto; padding: 0px; text-indent: 0px; color: rgb(57, 57, 57); font-family: verdana, &quot;ms song&quot;, Arial, Helvetica, sans-serif; font-size: 14px; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: left; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(250, 247, 239);"></p><div><span style="font-size: 12px;">二、例子</span></div><div><span style="font-size: 12px;">例1：在资源窗口手动增加一个控件IDC_PROGRESS1</span></div><div><span style="font-size: 12px;">CProgressCtrl *myProCtrl2 = (CProgressCtrl *)GetDlgItem(IDC_PROGRESS1);</span></div><div><span style="font-size: 12px;">myProCtrl2-&gt;SetRange(0,100);</span></div><div><span style="font-size: 12px;">for (int i = 0;i&lt;100;i++)</span></div><div><span style="font-size: 12px;">{</span></div><div><span style="font-size: 12px;">//myProCtrl2-&gt;OffsetPos(1); //此句代码等同于下两句，以固定步长1更新显示，该功能也可以这样实现：myProCtrl2-&gt;SetPos(i);</span><span style="font-size: 12px;"> </span></div><div><span style="font-size: 12px;">myProCtrl2-&gt;SetStep(1);</span></div><div><span style="font-size: 12px;">myProCtrl2-&gt;StepIt();</span></div><div><span style="font-size: 12px;">Sleep(100);</span></div><div style="margin-top: 1em; margin-bottom: 1em;"><span style="font-size: 12px;-en-paragraph:true;">}</span></div><p style="margin: 10px auto; padding: 0px; text-indent: 0px; color: rgb(57, 57, 57); font-family: verdana, &quot;ms song&quot;, Arial, Helvetica, sans-serif; font-size: 14px; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: left; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(250, 247, 239);"></p><div><span style="font-size: 12px;">例2：资源窗口不增加，直接通过代码生成进度条</span></div><div><span style="font-size: 12px;">CProgressCtrl myProCtrl;</span></div><div><span style="font-size: 12px;">CRect rect,proRect;</span></div><div><span style="font-size: 12px;">GetClientRect(&amp;rect);</span></div><div><span style="font-size: 12px;">proRect.left = rect.left + rect.Width()/2 - 100;</span></div><div><span style="font-size: 12px;">proRect.top = rect.top + rect.Height()/2 - 20;</span></div><div><span style="font-size: 12px;">proRect.right = rect.right - rect.Width()/2 + 100;</span></div><div><span style="font-size: 12px;">proRect.bottom = rect.bottom - rect.Height()/2 + 20;</span></div><div><span style="font-size: 12px;">//WS_CHILD|WS_VISIBLE|PBS_SMOOTHREVERSE</span><span style="font-size: 12px;"> </span></div><div><span style="font-size: 12px;">myProCtrl.Create(WS_VISIBLE,proRect,this,99); //创建位置、大小</span></div><div><span style="font-size: 12px;">myProCtrl.SetRange(0,100);</span></div><div><span style="font-size: 12px;">int i;</span></div><div><span style="font-size: 12px;">for (i = 0; i &lt; 100; i++)</span></div><div><span style="font-size: 12px;">{</span></div><div><span style="font-size: 12px;">myProCtrl.OffsetPos(1);</span></div><div><span style="font-size: 12px;">CString str;</span></div><div><span style="font-size: 12px;">str.Format(_T(&quot;%d%%&quot;),i); //百分比</span></div><div><span style="font-size: 12px;">(GetDlgItem(IDC_STATIC1))-&gt;SetWindowText(str);</span></div><div><span style="font-size: 12px;">Sleep(100);</span></div><div style="margin-top: 1em; margin-bottom: 1em;"><span style="font-size: 12px;-en-paragraph:true;">}</span></div><div style="margin: 10px auto; padding: 0px; text-indent: 0px; font-size: 14px; letter-spacing: normal; orphans: 2; text-align: left; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(250, 247, 239);"><span style="text-indent: 0px; font-size: 12px; letter-spacing: normal; orphans: 2; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(250, 247, 239); color: rgb(57, 57, 57); font-family: verdana, &quot;ms song&quot;, Arial, Helvetica, sans-serif; font-variant-caps: normal; font-variant-ligatures: normal;"> </span></div></div></span>
</div>
<hr>
<a name="1030"/>

<div>
<span><div><div style="margin: 0mm; text-indent: 7mm; padding-top: 0mm; padding-bottom: 0mm; min-height: 30pt; text-align: justify;"><span style="text-indent: 7mm; min-height: 30pt; font-family: 宋体; color: rgb(1, 1, 1); font-size: 10.5pt; background: #ff0000;">重要通知：以下字符串有报错的话，请加上</span><span style="text-indent: 7mm; min-height: 30pt; font-family: Calibri; color: rgb(1, 1, 1); font-size: 10.5pt; background: #ff0000;">_T</span></div><div style="margin: 0mm; text-indent: 7mm; padding-top: 0mm; padding-bottom: 0mm; min-height: 15pt; text-align: justify;"><span style="text-indent: 7mm; min-height: 15pt; font-family: 宋体; color: rgb(1, 1, 1); font-size: 10.5pt;">添加控件：</span></div><div style="margin: 0mm; text-indent: 7mm; padding-top: 0mm; padding-bottom: 0mm; min-height: 108pt; text-align: justify;"><img src="MFC_files/Image.png" type="image/png" data-filename="Image.png" width="650"/></div><div style="margin: 0mm; text-indent: 7mm; padding-top: 0mm; padding-bottom: 0mm; min-height: 15pt; text-align: justify;"><span style="text-indent: 7mm; min-height: 15pt; font-family: 宋体; color: rgb(1, 1, 1); font-size: 10.5pt;">下拉框：以下</span><span style="text-indent: 7mm; min-height: 15pt; font-family: ������; font-size: 9.5pt;">new_list控件变量名 </span> <span style="text-indent: 7mm; min-height: 15pt; font-family: ������; color: rgb(111, 0, 138); font-size: 9.5pt;">IDC_COMBO1控件ID  与数组用点像，第零行为第一个数，</span></div><div style="min-height: 309pt; text-align: justify;"><img src="MFC_files/Image [1].png" type="image/png" data-filename="Image.png" width="692"/></div><div style="min-height: 14pt; text-align: justify;"><span style="min-height: 14pt; font-family: 新宋体; font-size: 9.5pt;">控制Combo Box的下拉长度：</span></div><ol style="margin-top: 0mm; margin-bottom: 0mm; margin-left: 0mm; padding-left: 0pt;"><li style="margin-left: 15pt; margin-right: 0pt; padding-left: -18pt; text-indent:0pt; font-family: ������; font-size: 9.5pt;"><div style="min-height: 14pt; text-align: justify;"><span style="min-height: 14pt; font-family: ������; font-size: 9.5pt; color: #000000; font-decoration: Normal;">点击一下Combo Box的下拉箭头，此时出现的调整框就是Combo Box的下拉调整框。</span></div></li></ol><div style="min-height: 109pt; text-align: justify;"><img src="MFC_files/Image [2].png" type="image/png" data-filename="Image.png" width="144"/><span style="min-height: 109pt; font-family: Calibri; color: rgb(1, 1, 1); font-size: 10.5pt;"> </span> <span style="min-height: 109pt; font-family: 宋体; color: rgb(1, 1, 1); font-size: 10.5pt;">点击</span><span style="min-height: 109pt; font-family: Calibri; color: rgb(1, 1, 1); font-size: 10.5pt;"> </span> <img src="MFC_files/Image [3].png" type="image/png" data-filename="Image.png" width="148"/> <span style="min-height: 109pt; font-family: 宋体; color: rgb(1, 1, 1); font-size: 10.5pt;">拉长即可</span><span style="min-height: 109pt; font-family: 新宋体; font-size: 9.5pt;">调整高度</span></div><div style="min-height: 14pt; text-align: justify;"><span style="min-height: 14pt; font-family: ������; font-size: 9.5pt;">2.属性里有个 No integral height 钩选项，表示最大长度为设计长度，如果实际内容比设计长度多，就出现滚动条，</span><span style="min-height: 14pt; font-family: 宋体; color: rgb(77, 77, 77); font-size: 12.0pt;">少就以实际长度显示。</span></div><div style="min-height: 273pt; text-align: justify;"><img src="MFC_files/Image [4].png" type="image/png" data-filename="Image.png" width="378"/></div><div style="min-height: 28pt; text-align: justify;"><span style="min-height: 28pt; font-family: Calibri; color: rgb(1, 1, 1); font-size: 10.5pt;">//</span><span style="min-height: 28pt; font-family: 宋体; color: rgb(1, 1, 1); font-size: 10.5pt;">初始化进行下拉框赋值</span> <span style="min-height: 28pt; font-family: 宋体; color: rgb(1, 1, 1); font-size: 10.5pt;">，在函数</span><span style="min-height: 28pt; font-family: ������; font-size: 9.5pt;">OnInitDialog进行，本次编写用的是（多字接）</span></div><div style="min-height: 14pt; text-align: justify;"><span style="min-height: 14pt; font-family: ������; font-size: 9.5pt;">//循环初始化</span></div><div style="min-height: 13pt; text-align: left;"><span style="min-height: 13pt; font-family: ������; color: rgb(43, 145, 175); font-size: 9.5pt;">CString</span> <span style="min-height: 13pt; font-family: ������; font-size: 9.5pt;">strTemp;</span></div><div style="min-height: 13pt; text-align: left;"><span style="min-height: 13pt; font-family: ������; color: rgb(0, 0, 255); font-size: 9.5pt;">for</span> <span style="min-height: 13pt; font-family: ������; font-size: 9.5pt;">(</span><span style="min-height: 13pt; font-family: ������; color: rgb(0, 0, 255); font-size: 9.5pt;">int</span> <span style="min-height: 13pt; font-family: ������; font-size: 9.5pt;">i = 1; i &lt;= 10; i++)</span></div><div style="min-height: 13pt; text-align: left;"><span style="min-height: 13pt; font-family: ������; font-size: 9.5pt;">{</span></div><div style="margin: 0mm; text-indent: 3mm; padding-top: 0mm; padding-bottom: 0mm; min-height: 14pt; text-align: left;"><span style="text-indent: 3mm; min-height: 14pt; font-family: ������; font-size: 9.5pt;">strTemp.Format(</span><span style="text-indent: 3mm; min-height: 14pt; font-family: ������; color: rgb(163, 21, 21); font-size: 9.5pt;">&quot;%d&quot;</span><span style="text-indent: 3mm; min-height: 14pt; font-family: ������; font-size: 9.5pt;">, i);  (Unicode的话改成：把</span><span style="text-indent: 3mm; min-height: 14pt; font-family: ������; color: rgb(163, 21, 21); font-size: 9.5pt;">&quot;%d&quot; 改为 _T(&quot;%d&quot;)</span><span style="text-indent: 3mm; min-height: 14pt; font-family: ������; font-size: 9.5pt;">)</span></div><div style="min-height: 13pt; text-align: left;"><span style="min-height: 13pt; font-family: ������; font-size: 9.5pt;">    ((</span><span style="min-height: 13pt; font-family: ������; color: rgb(43, 145, 175); font-size: 9.5pt;">CComboBox</span><span style="min-height: 13pt; font-family: ������; font-size: 9.5pt;">*)GetDlgItem(</span><span style="min-height: 13pt; font-family: ������; color: rgb(111, 0, 138); font-size: 9.5pt;">IDC_COMBO1</span><span style="min-height: 13pt; font-family: ������; font-size: 9.5pt;">))-&gt;AddString(strTemp);</span></div><div style="min-height: 13pt; text-align: justify;"><span style="min-height: 13pt; font-family: ������; font-size: 9.5pt;">}</span></div><div style="min-height: 14pt; text-align: justify;"><span style="min-height: 14pt; font-family: ������; font-size: 9.5pt;">//单个初始化</span></div><div style="min-height: 14pt; text-align: justify;"><span style="min-height: 14pt; font-family: ������; font-size: 9.5pt;">new_list.AddString(</span><span style="min-height: 14pt; font-family: ������; color: rgb(163, 21, 21); font-size: 9.5pt;">&quot;加法&quot;</span><span style="min-height: 14pt; font-family: ������; font-size: 9.5pt;">);</span></div><div style="min-height: 14pt; text-align: justify;"><span style="min-height: 14pt; font-family: ������; font-size: 9.5pt;">new_list.AddString(</span><span style="min-height: 14pt; font-family: ������; color: rgb(163, 21, 21); font-size: 9.5pt;">&quot;加法&quot;</span><span style="min-height: 14pt; font-family: ������; font-size: 9.5pt;">);</span></div><div style="min-height: 14pt; text-align: justify;"><span style="min-height: 14pt; font-family: ������; font-size: 9.5pt;">new_list.AddString(</span><span style="min-height: 14pt; font-family: ������; color: rgb(163, 21, 21); font-size: 9.5pt;">&quot;加法&quot;</span><span style="min-height: 14pt; font-family: ������; font-size: 9.5pt;">);</span></div><div style="min-height: 15pt; text-align: justify;"><span style="min-height: 15pt; font-family: 新宋体; font-size: 9.5pt;">或者</span></div><div style="min-height: 14pt; text-align: justify;"><span style="min-height: 14pt; font-family: ������; font-size: 9.5pt;">new_list.AddString(_T(</span><span style="min-height: 14pt; font-family: ������; color: rgb(163, 21, 21); font-size: 9.5pt;">&quot;加法&quot;)</span><span style="min-height: 14pt; font-family: ������; font-size: 9.5pt;">);</span></div><div style="min-height: 14pt; text-align: justify;"><span style="min-height: 14pt; font-family: ������; font-size: 9.5pt;">new_list.AddString(_T(</span><span style="min-height: 14pt; font-family: ������; color: rgb(163, 21, 21); font-size: 9.5pt;">&quot;加法&quot;)</span><span style="min-height: 14pt; font-family: ������; font-size: 9.5pt;">);</span></div><div style="min-height: 14pt; text-align: justify;"><span style="min-height: 14pt; font-family: ������; font-size: 9.5pt;">new_list.AddString(_T(</span><span style="min-height: 14pt; font-family: ������; color: rgb(163, 21, 21); font-size: 9.5pt;">&quot;加法&quot;)</span><span style="min-height: 14pt; font-family: ������; font-size: 9.5pt;">);</span></div><div style="min-height: 14pt; text-align: justify;"><span style="min-height: 14pt; font-family: ������; font-size: 9.5pt;">//初始化默认显示第0行的内容</span></div><div style="min-height: 13pt; text-align: justify;"><span style="min-height: 13pt; font-family: ������; font-size: 9.5pt;">int a =0;</span></div><div style="min-height: 13pt; text-align: justify;"><span style="min-height: 13pt; font-family: ������; font-size: 9.5pt;">((</span><span style="min-height: 13pt; font-family: ������; color: rgb(43, 145, 175); font-size: 9.5pt;">CComboBox</span><span style="min-height: 13pt; font-family: ������; font-size: 9.5pt;">*)GetDlgItem(</span><span style="min-height: 13pt; font-family: ������; color: rgb(111, 0, 138); font-size: 9.5pt;">IDC_COMBO1</span><span style="min-height: 13pt; font-family: ������; font-size: 9.5pt;">))-&gt;SetCurSel(a);</span></div><div style="min-height: 30pt; text-align: justify;"><span style="min-height: 30pt; font-family: Calibri; color: rgb(1, 1, 1); font-size: 10.5pt;">//</span><span style="min-height: 30pt; font-family: 宋体; color: rgb(1, 1, 1); font-size: 10.5pt;">以下都是下拉框的一些方法，</span><span style="min-height: 30pt; font-family: 宋体; color: rgb(1, 1, 1); font-size: 10.5pt; background: #ff0000;">看注释</span><span style="min-height: 30pt; font-family: 宋体; color: rgb(1, 1, 1); font-size: 10.5pt;">！！！</span></div><div style="margin: 0mm; text-indent: 3mm; padding-top: 0mm; padding-bottom: 0mm; min-height: 14pt; text-align: left;"><span style="text-indent: 3mm; min-height: 14pt; font-family: ������; color: rgb(0, 128, 0); font-size: 9.5pt;">//取得目前已经有的行数</span></div><div style="min-height: 13pt; text-align: left;"><span style="min-height: 13pt; font-family: ������; font-size: 9.5pt;">    </span><span style="min-height: 13pt; font-family: ������; color: rgb(0, 0, 255); font-size: 9.5pt;">int</span> <span style="min-height: 13pt; font-family: ������; font-size: 9.5pt;">iCount = ((</span><span style="min-height: 13pt; font-family: ������; color: rgb(43, 145, 175); font-size: 9.5pt;">CComboBox</span><span style="min-height: 13pt; font-family: ������; font-size: 9.5pt;">*)GetDlgItem(</span><span style="min-height: 13pt; font-family: ������; color: rgb(111, 0, 138); font-size: 9.5pt;">IDC_COMBO1</span><span style="min-height: 13pt; font-family: ������; font-size: 9.5pt;">))-&gt;GetCount();</span></div><div style="min-height: 13pt; text-align: left;"><span style="min-height: 13pt; font-family: ������; font-size: 9.5pt;">    </span><span style="min-height: 13pt; font-family: ������; color: rgb(43, 145, 175); font-size: 9.5pt;">CString</span> <span style="min-height: 13pt; font-family: ������; font-size: 9.5pt;">str1;</span></div><div style="min-height: 13pt; text-align: left;"><span style="min-height: 13pt; font-family: ������; font-size: 9.5pt;">    str1.Format(</span><span style="min-height: 13pt; font-family: ������; color: rgb(163, 21, 21); font-size: 9.5pt;">&quot;%d&quot;</span><span style="min-height: 13pt; font-family: ������; font-size: 9.5pt;">, iCount);</span></div><div style="min-height: 14pt; text-align: justify;"><span style="min-height: 14pt; font-family: ������; font-size: 9.5pt;">    </span><span style="min-height: 14pt; font-family: ������; color: rgb(111, 0, 138); font-size: 9.5pt;">MessageBox</span><span style="min-height: 14pt; font-family: ������; font-size: 9.5pt;">(str1,</span> <span style="min-height: 14pt; font-family: ������; color: rgb(163, 21, 21); font-size: 9.5pt;">&quot;行数&quot;</span><span style="min-height: 14pt; font-family: ������; font-size: 9.5pt;">,</span> <span style="min-height: 14pt; font-family: ������; color: rgb(111, 0, 138); font-size: 9.5pt;">MB_OK</span><span style="min-height: 14pt; font-family: ������; font-size: 9.5pt;">);//</span></div><div style="min-height: 14pt; text-align: left;"><span style="min-height: 14pt; font-family: ������; color: rgb(0, 128, 0); font-size: 9.5pt;">//获取当前行选中行的内容</span></div><div style="min-height: 13pt; text-align: left;"><span style="min-height: 13pt; font-family: ������; color: rgb(43, 145, 175); font-size: 9.5pt;">CString</span> <span style="min-height: 13pt; font-family: ������; font-size: 9.5pt;">str1;</span></div><div style="min-height: 13pt; text-align: left;"><span style="min-height: 13pt; font-family: ������; font-size: 9.5pt;">((</span><span style="min-height: 13pt; font-family: ������; color: rgb(43, 145, 175); font-size: 9.5pt;">CComboBox</span><span style="min-height: 13pt; font-family: ������; font-size: 9.5pt;">*)GetDlgItem(</span><span style="min-height: 13pt; font-family: ������; color: rgb(111, 0, 138); font-size: 9.5pt;">IDC_COMBO1</span><span style="min-height: 13pt; font-family: ������; font-size: 9.5pt;">))-&gt;</span><span style="min-height: 13pt; font-family: ������; color: rgb(111, 0, 138); font-size: 9.5pt;">GetWindowText</span><span style="min-height: 13pt; font-family: ������; font-size: 9.5pt;">(str1);</span></div><div style="min-height: 14pt; text-align: justify;"><span style="min-height: 14pt; font-family: ������; color: rgb(111, 0, 138); font-size: 9.5pt;">SetDlgItemText</span><span style="min-height: 14pt; font-family: ������; font-size: 9.5pt;">(</span><span style="min-height: 14pt; font-family: ������; color: rgb(111, 0, 138); font-size: 9.5pt;">Value1</span><span style="min-height: 14pt; font-family: ������; font-size: 9.5pt;">, str1);//我把它传给了一个文本编辑框,</span><span style="min-height: 14pt; font-family: ������; color: rgb(111, 0, 138); font-size: 9.5pt;">Value1</span><span style="min-height: 14pt; font-family: 新宋体; font-size: 9.5pt;">是编辑框的ID；str1就是内容（Cstring类型的）</span></div><div style="min-height: 14pt; text-align: left;"><span style="min-height: 14pt; font-family: ������; color: rgb(0, 128, 0); font-size: 9.5pt;">//可以在当前所有行中查找指定的字符传的位置，1是指定开始查的位置；aa视察的内容，a是返回第几行</span></div><div style="min-height: 13pt; text-align: left;"><span style="min-height: 13pt; font-family: ������; font-size: 9.5pt;">    </span><span style="min-height: 13pt; font-family: ������; color: rgb(43, 145, 175); font-size: 9.5pt;">CString</span> <span style="min-height: 13pt; font-family: ������; font-size: 9.5pt;">aa;</span></div><div style="min-height: 14pt; text-align: left;"><span style="min-height: 14pt; font-family: ������; font-size: 9.5pt;">    aa.Format(</span><span style="min-height: 14pt; font-family: ������; color: rgb(163, 21, 21); font-size: 9.5pt;">&quot;%s&quot;</span><span style="min-height: 14pt; font-family: ������; font-size: 9.5pt;">,</span> <span style="min-height: 14pt; font-family: ������; color: rgb(163, 21, 21); font-size: 9.5pt;">&quot;加法&quot;</span><span style="min-height: 14pt; font-family: ������; font-size: 9.5pt;">);</span></div><div style="min-height: 14pt; text-align: justify;"><span style="min-height: 14pt; font-family: ������; font-size: 9.5pt;">    </span><span style="min-height: 14pt; font-family: ������; color: rgb(0, 0, 255); font-size: 9.5pt;">int</span> <span style="min-height: 14pt; font-family: ������; font-size: 9.5pt;">a=new_list.FindString(1,aa);//就是查找“加法”是第几行的内容</span></div><div style="min-height: 14pt; text-align: left;"><span style="min-height: 14pt; font-family: ������; color: rgb(0, 128, 0); font-size: 9.5pt;">//返回当前内容是第几行,</span></div><div style="min-height: 13pt; text-align: justify;"><span style="min-height: 13pt; font-family: ������; font-size: 9.5pt;">    </span><span style="min-height: 13pt; font-family: ������; color: rgb(0, 0, 255); font-size: 9.5pt;">int</span> <span style="min-height: 13pt; font-family: ������; font-size: 9.5pt;">iPos = ((</span><span style="min-height: 13pt; font-family: ������; color: rgb(43, 145, 175); font-size: 9.5pt;">CComboBox</span><span style="min-height: 13pt; font-family: ������; font-size: 9.5pt;">*)GetDlgItem(</span><span style="min-height: 13pt; font-family: ������; color: rgb(111, 0, 138); font-size: 9.5pt;">IDC_COMBO1</span><span style="min-height: 13pt; font-family: ������; font-size: 9.5pt;">))-&gt;GetCurSel();</span></div><div style="min-height: 14pt; text-align: left;"><span style="min-height: 14pt; font-family: ������; color: rgb(0, 128, 0); font-size: 9.5pt;">//删除指定行，a是第几行</span></div><div style="min-height: 13pt; text-align: justify;"><span style="min-height: 13pt; font-family: ������; font-size: 9.5pt;">    new_list.DeleteString(a);</span></div><div style="min-height: 14pt; text-align: left;"><span style="min-height: 14pt; font-family: ������; color: rgb(0, 128, 0); font-size: 9.5pt;">////将行插入到指定位置，在第0行插入内容</span></div><div style="min-height: 14pt; text-align: justify;"><span style="min-height: 14pt; font-family: ������; font-size: 9.5pt;">    new_list.InsertString(0,</span> <span style="min-height: 14pt; font-family: ������; color: rgb(163, 21, 21); font-size: 9.5pt;">&quot;我们&quot;</span><span style="min-height: 14pt; font-family: ������; font-size: 9.5pt;">);</span></div><div style="min-height: 15pt; text-align: justify;"><span style="min-height: 15pt; font-family: 宋体; color: rgb(1, 1, 1); font-size: 10.5pt;">提高篇（控件应用方案）</span></div><div style="min-height: 30pt; text-align: justify;"><span style="min-height: 30pt; font-family: Calibri; color: rgb(1, 1, 1); font-size: 10.5pt;">1</span><span style="min-height: 30pt; font-family: 宋体; color: rgb(1, 1, 1); font-size: 10.5pt;">．功能</span></div><div style="min-height: 23pt; text-align: justify;"><span style="min-height: 23pt; font-family: 宋体; color: rgb(1, 1, 1); font-size: 10.5pt;">组合框（</span><span style="min-height: 23pt; font-family: Calibri; color: rgb(1, 1, 1); font-size: 10.5pt;">ComboBox</span><span style="min-height: 23pt; font-family: 宋体; color: rgb(1, 1, 1); font-size: 10.5pt;">）是文本框（</span><span style="min-height: 23pt; font-family: Calibri; color: rgb(1, 1, 1); font-size: 10.5pt;">TextBox</span><span style="min-height: 23pt; font-family: 宋体; color: rgb(1, 1, 1); font-size: 10.5pt;">）和列表框（</span><span style="min-height: 23pt; font-family: Calibri; color: rgb(1, 1, 1); font-size: 10.5pt;">ListBox</span><span style="min-height: 23pt; font-family: 宋体; color: rgb(1, 1, 1); font-size: 10.5pt;">）的组合。用户可以从文本框中输入文本，也可以从列表框中选取列表项。</span></div><div style="min-height: 30pt; text-align: justify;"><span style="min-height: 30pt; font-family: Calibri; color: rgb(1, 1, 1); font-size: 10.5pt;">2</span><span style="min-height: 30pt; font-family: 宋体; color: rgb(1, 1, 1); font-size: 10.5pt;">．属性</span></div><div style="min-height: 23pt; text-align: justify;"><span style="min-height: 23pt; font-family: Calibri; color: rgb(1, 1, 1); font-size: 10.5pt;">ComboBox</span><span style="min-height: 23pt; font-family: 宋体; color: rgb(1, 1, 1); font-size: 10.5pt;">控件的常用属性如表</span><span style="min-height: 23pt; font-family: Calibri; color: rgb(1, 1, 1); font-size: 10.5pt;">1</span><span style="min-height: 23pt; font-family: 宋体; color: rgb(1, 1, 1); font-size: 10.5pt;">所示。</span></div><div style="min-height: 23pt; text-align: justify;"><span style="min-height: 23pt; font-family: 宋体; color: rgb(1, 1, 1); font-size: 10.5pt;">表</span><span style="min-height: 23pt; font-family: Calibri; color: rgb(1, 1, 1); font-size: 10.5pt;">1 ComboBox</span><span style="min-height: 23pt; font-family: 宋体; color: rgb(1, 1, 1); font-size: 10.5pt;">控件的常用属性</span></div><div style="min-height: 23pt; text-align: justify;"><span style="min-height: 23pt; font-family: 宋体; color: rgb(1, 1, 1); font-size: 10.5pt;">编号</span><span style="min-height: 23pt; font-family: Calibri; color: rgb(1, 1, 1); font-size: 10.5pt;"> </span> <span style="min-height: 23pt; font-family: 宋体; color: rgb(1, 1, 1); font-size: 10.5pt;">属性</span><span style="min-height: 23pt; font-family: Calibri; color: rgb(1, 1, 1); font-size: 10.5pt;"> </span> <span style="min-height: 23pt; font-family: 宋体; color: rgb(1, 1, 1); font-size: 10.5pt;">说明</span></div><div style="min-height: 23pt; text-align: justify;"><span style="min-height: 23pt; font-family: Calibri; color: rgb(1, 1, 1); font-size: 10.5pt;">1  IntegralHeight </span> <span style="min-height: 23pt; font-family: 宋体; color: rgb(1, 1, 1); font-size: 10.5pt;">返回或设置一个值，指示控件是否显示部分项目。运行时是只读的</span></div><div style="min-height: 23pt; text-align: justify;"><span style="min-height: 23pt; font-family: Calibri; color: rgb(1, 1, 1); font-size: 10.5pt;">2  List </span> <span style="min-height: 23pt; font-family: 宋体; color: rgb(1, 1, 1); font-size: 10.5pt;">返回或设置控件列表部分的项目</span></div><div style="min-height: 23pt; text-align: justify;"><span style="min-height: 23pt; font-family: Calibri; color: rgb(1, 1, 1); font-size: 10.5pt;">3  ListCount </span> <span style="min-height: 23pt; font-family: 宋体; color: rgb(1, 1, 1); font-size: 10.5pt;">返回控件的列表部分项目的个数</span></div><div style="min-height: 23pt; text-align: justify;"><span style="min-height: 23pt; font-family: Calibri; color: rgb(1, 1, 1); font-size: 10.5pt;">4  ListIndex </span> <span style="min-height: 23pt; font-family: 宋体; color: rgb(1, 1, 1); font-size: 10.5pt;">返回或设置控件中当前选择项目的索引，在设计时不可用</span></div><div style="min-height: 23pt; text-align: justify;"><span style="min-height: 23pt; font-family: Calibri; color: rgb(1, 1, 1); font-size: 10.5pt;">5  Locked </span> <span style="min-height: 23pt; font-family: 宋体; color: rgb(1, 1, 1); font-size: 10.5pt;">返回或设置一个值，以指定控件是否可被编辑</span></div><div style="min-height: 23pt; text-align: justify;"><span style="min-height: 23pt; font-family: Calibri; color: rgb(1, 1, 1); font-size: 10.5pt;">6  Sorted </span> <span style="min-height: 23pt; font-family: 宋体; color: rgb(1, 1, 1); font-size: 10.5pt;">返回一个值，指定控件的元素是否自动按字母表顺序排序</span></div><div style="min-height: 31pt; text-align: justify;"><span style="min-height: 31pt; font-family: Calibri; color: rgb(1, 1, 1); font-size: 10.5pt;">7  Style </span> <span style="min-height: 31pt; font-family: 宋体; color: rgb(1, 1, 1); font-size: 10.5pt;">返回或设置一个值，该值用来指示控件的显示类型和行为</span></div><div style="min-height: 23pt; text-align: justify;"><span style="min-height: 23pt; font-family: Calibri; color: rgb(1, 1, 1); font-size: 10.5pt;">8  TabIndex </span> <span style="min-height: 23pt; font-family: 宋体; color: rgb(1, 1, 1); font-size: 10.5pt;">返回或设置父窗体中大部分对象的〈</span><span style="min-height: 23pt; font-family: Calibri; color: rgb(1, 1, 1); font-size: 10.5pt;">Tab</span><span style="min-height: 23pt; font-family: 宋体; color: rgb(1, 1, 1); font-size: 10.5pt;">〉键次序</span></div><div style="min-height: 23pt; text-align: justify;"><span style="min-height: 23pt; font-family: Calibri; color: rgb(1, 1, 1); font-size: 10.5pt;">9  Text ComboBox</span> <span style="min-height: 23pt; font-family: 宋体; color: rgb(1, 1, 1); font-size: 10.5pt;">控件（</span><span style="min-height: 23pt; font-family: Calibri; color: rgb(1, 1, 1); font-size: 10.5pt;">Style</span><span style="min-height: 23pt; font-family: 宋体; color: rgb(1, 1, 1); font-size: 10.5pt;">属性设置为</span><span style="min-height: 23pt; font-family: Calibri; color: rgb(1, 1, 1); font-size: 10.5pt;">0</span><span style="min-height: 23pt; font-family: 宋体; color: rgb(1, 1, 1); font-size: 10.5pt;">（下拉组合框）或为</span><span style="min-height: 23pt; font-family: Calibri; color: rgb(1, 1, 1); font-size: 10.5pt;">1</span><span style="min-height: 23pt; font-family: 宋体; color: rgb(1, 1, 1); font-size: 10.5pt;">（简单组合框））返回或设置编辑域中的文本</span><span style="min-height: 23pt; font-family: Calibri; color: rgb(1, 1, 1); font-size: 10.5pt;"> </span></div><div style="min-height: 14pt; text-align: justify;"><br/><br/></div><div style="min-height: 30pt; text-align: justify;"></div></div></span>
</div></body></html> 